package hieudao.exercise_collection.views;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import hieudao.exercise_collection.controllers.LibraryManagementController;

public class LibraryManagementView {
	
	public static void main(String[] args) throws IOException {
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		LibraryManagementController objController = new LibraryManagementController();
		String optionByUser="";
		do {
			System.out.println("The system is running");
			System.out.println("You want to handle with Book. Please you enter number 1 ");
			System.out.println("You want to handle with Reader. Please you enter number 2 ");
			System.out.println("You want to handle with rent book. Please you enter number 3 ");
			System.out.println("You want to exit system. Please you enter \"n\"on the keyboard");
			optionByUser = bf.readLine();
			if ((optionByUser.equals("1"))||(optionByUser.equals("2"))||(optionByUser.equals("3"))||(optionByUser.equals("4"))){
				objController.executeByOption(optionByUser);
			}else if (optionByUser.equalsIgnoreCase("N")){
				System.out.println("Do you really want to exit application? You enter \"n\" to continue or \"y\" on keyboard to exit application");
				optionByUser = bf.readLine();
				if(optionByUser.equalsIgnoreCase("y")){
					optionByUser = "n";
				}
			}
		} while (!optionByUser.equalsIgnoreCase("N"));
	}
}
